package com.hl233.framework.utils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @author 张振强15065206763
 * @create 2024-09-08
 */
@Component
public class EnvironmentBean {

    private Environment environment;

    @Autowired
    public EnvironmentBean(Environment environment) {
        this.environment = environment;
    }

    @PostConstruct
    public void readProperties() {
        String myProperty = environment.getProperty("my.property");
        // 使用 myProperty
    }

    public Environment getEnvironment() {
        return environment;
    }
}
